package com.bw.lib_storage.db.entity

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import java.util.Date

@Entity(tableName = "history")
data class History(
    @ColumnInfo(name = "id")
    @PrimaryKey(autoGenerate = true) //主键自增
    val id: Int = 0,
    
    // 视频基本信息
    @ColumnInfo(name = "video_id")
    val videoId: String, // 视频唯一标识
    
    @ColumnInfo(name = "title")
    val title: String, // 视频标题
    
    @ColumnInfo(name = "content")
    val content: String = "", // 视频描述
    
    @ColumnInfo(name = "cover_url")
    val coverUrl: String = "", // 封面图片URL
    
    @ColumnInfo(name = "video_url")
    val videoUrl: String = "", // 视频播放URL
    
    @ColumnInfo(name = "duration")
    val duration: Long = 0, // 视频总时长(毫秒)
    
    // 播放进度相关
    @ColumnInfo(name = "current_position")
    val currentPosition: Long = 0, // 当前播放位置(毫秒)
    
    @ColumnInfo(name = "progress_percentage")
    val progressPercentage: Float = 0f, // 播放进度百分比(0-100)
    
    // 时间相关
    @ColumnInfo(name = "last_play_time")
    val lastPlayTime: Date = Date(), // 最后播放时间
    
    @ColumnInfo(name = "query_time")
    val queryTime: Date = Date(), // 查询时间(保持兼容性)
    
    // 用户相关
    @ColumnInfo(name = "user_id")
    val userId: String = "", // 用户ID
    
    // 其他信息
    @ColumnInfo(name = "author_name")
    val authorName: String = "", // 作者名称
    
    @ColumnInfo(name = "play_count")
    val playCount: Int = 1, // 播放次数
    
    @ColumnInfo(name = "is_completed")
    val isCompleted: Boolean = false // 是否播放完成
)
